/**
 * 
 */
package com.java.controller.admin;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.java.entity.Course;
import com.java.entity.Student;
import com.java.entity.Users;
import com.java.service.impl.CollegeServiceImpl;
import com.java.service.impl.CourseServiceImpl;
import com.java.service.impl.StudentServiceImpl;
import com.java.service.impl.TeacherSeriveImpl;

/**
* @author Kidney
* 创建时间：2019年4月29日 下午3:04:51
* Description:
*/
/**
 * @author KIDNEY
 *
 */
@Controller
public class StudentController {

	@Autowired
	private CourseServiceImpl cs;

	@Autowired
	private CollegeServiceImpl cos;

	@Autowired
	private TeacherSeriveImpl ts;

	@Autowired
	private StudentServiceImpl ss;

	@RequestMapping(value = "all_student", produces = "application/json; charset=utf-8")
	@ResponseBody
	public String allStudent(HttpServletResponse response) {
		List<Student> studentList = ss.allStudent();
		String jsonString = JSON.toJSONString(studentList);
		return jsonString;
	}	

	@RequestMapping("student_home")
	public String sc() {
		return "pages/admin/studentHome.jsp";
	}
	
	@RequestMapping(value = "student_insert", produces = "application/json; charset=utf-8")
	@ResponseBody
	public Integer insertStudent(String username,Integer userid,String sex,  Integer collegeid,Integer grade) {
		int flag = ss.insert(username, userid, sex, collegeid, grade);
		return flag;
	}
	
	
	@RequestMapping(value = "student_delete", produces = "application/json; charset=utf-8")
	@ResponseBody
	public Integer deleteStudent(Integer userid) {
		int flag = ss.delete(userid);
		return flag;
	}
	

}
